<?php

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\Api\AuthController;
use App\Http\Controllers\Api\UserController;
use App\Http\Controllers\Api\DictController;

// 用户相关路由
Route::prefix('user')->group(function () {
    // 登录路由（无需认证）
    Route::post('/login', [AuthController::class, 'login']);
    
    // 需要认证的路由
    Route::middleware('auth:sanctum')->group(function () {
        Route::post('/logout', [AuthController::class, 'logout']);
        Route::get('/getUserInfo', [UserController::class, 'getUserInfo']);
        Route::get('/getUserRoutes', [UserController::class, 'getUserRoutes']);
    });
});

// 系统管理相关路由
Route::prefix('system')->group(function () {
    // 字典相关路由（暂时不需要认证，便于调试）
    Route::prefix('dict')->group(function () {
        Route::get('/getDictData', [DictController::class, 'getDictData']);
        Route::get('/getDictDataList', [DictController::class, 'getDictDataList']);
    });
});

// 测试路由
Route::middleware('auth:sanctum')->get('/user', function (Request $request) {
    return $request->user();
}); 